package com.app.utils.impl.labour;

import android.os.Build;

import androidx.annotation.RequiresApi;

import com.app.utils.impl.IConsole;
import com.app.utils.impl.Strategy;
import com.zndroid.utils.XUtils;
import com.zndroid.utils.impl.StorageUtil;

/**
 * Created by lzy on 2022/2/16.
 */
public class StorageUtilStrategy extends Strategy {
    public StorageUtilStrategy(IConsole iConsole) {
        super(iConsole);
    }

    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
    @Override
    public void doing() {
        StorageUtil util = XUtils.create().storageUtil();

        iConsole.console("getAvailableExternalMemorySize", util.getFormattedSize(XUtils.getContext(), util.getAvailableExternalMemorySize()));
        iConsole.console("getExternalMemorySize", util.getFormattedSize(XUtils.getContext(), util.getExternalMemorySize()));
        iConsole.console("getRAMSize", util.getFormattedSize(XUtils.getContext(), util.getRAMSize(XUtils.getContext())));
        iConsole.console("getUsedRAMSize", util.getFormattedSize(XUtils.getContext(), util.getUsedRAMSize(XUtils.getContext())));
        iConsole.console("getRunTimeFreeMemory", util.getFormattedSize(XUtils.getContext(), util.getRunTimeFreeMemory()));
        iConsole.console("isSDCardExists", util.isSDCardExists() + "");
    }
}
